package com.grass.p019lv.activity;

import androidx.lifecycle.ViewModelProvider;
import com.alibaba.android.arouter.launcher.ARouter;
import com.androidx.p013lv.base.Constance;
import com.androidx.p013lv.base.bean.NoticeBean;
import com.androidx.p013lv.base.http.BaseRes;
import com.androidx.p013lv.base.interfaces.Key;
import com.androidx.p013lv.base.p015ui.BaseActivity;
import com.androidx.p013lv.base.utils.SpUtils;
import com.androidx.p013lv.base.utils.TimeUtils;
import com.grass.p019lv.R;
import com.grass.p019lv.bean.NoticeListBean;
import com.grass.p019lv.databinding.ActivityMessageBinding;
import com.grass.p019lv.viewmodel.MessageModel;
import com.gyf.immersionbar.ImmersionBar;
import java.util.List;

/* renamed from: com.grass.lv.activity.MessageActivity */
public class MessageActivity extends BaseActivity<ActivityMessageBinding> {
    public String backText;
    private NoticeBean noticeBean;

    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public int setLayout() {
        return R.layout.activity_message;
    }

    /* access modifiers changed from: protected */
    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public void initImmersionBar() {
        super.initImmersionBar();
        ImmersionBar.with(this).titleBar(((ActivityMessageBinding) this.binding).toolbar).init();
    }

    /* access modifiers changed from: protected */
    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public void initView() {
        super.initView();
        ((ActivityMessageBinding) this.binding).setStatus(0);
        ((ActivityMessageBinding) this.binding).setBackText(this.backText);
        ((ActivityMessageBinding) this.binding).setClick(new OnClick());
        ((ActivityMessageBinding) this.binding).tvContactOfficial.setText(String.format(getString(R.string.contact_official_title), TimeUtils.getCapitalMonth()));
        MessageModel messageModel = (MessageModel) new ViewModelProvider(this).get(MessageModel.class);
        messageModel.getNoticeLive().observe(this, new C2957b(this));
        messageModel.notificationList(1);
    }

    public /* synthetic */ void lambda$initView$0$MessageActivity(BaseRes baseRes) {
        NoticeListBean noticeListBean;
        List<NoticeBean> data;
        if (baseRes.getCode() == 200 && (noticeListBean = (NoticeListBean) baseRes.getData()) != null && (data = noticeListBean.getData()) != null && data.size() > 0) {
            this.noticeBean = data.get(0);
            ((ActivityMessageBinding) this.binding).setNoticeBean(this.noticeBean);
            if (this.noticeBean.getAnnId() != SpUtils.getInstance().getInt("noticeId")) {
                ((ActivityMessageBinding) this.binding).setStatus(1);
            } else {
                ((ActivityMessageBinding) this.binding).setStatus(0);
            }
        }
    }

    /* access modifiers changed from: protected */
    @Override // androidx.fragment.app.FragmentActivity
    public void onResume() {
        if (this.noticeBean != null) {
            if (this.noticeBean.getAnnId() != SpUtils.getInstance().getInt("noticeId")) {
                ((ActivityMessageBinding) this.binding).setStatus(1);
            } else {
                ((ActivityMessageBinding) this.binding).setStatus(0);
            }
        }
        super.onResume();
    }

    /* renamed from: com.grass.lv.activity.MessageActivity$OnClick */
    public class OnClick {
        public OnClick() {
        }

        public void btnBack() {
            if (!MessageActivity.this.isOnClick()) {
                MessageActivity.this.finish();
            }
        }

        public void btnFans() {
            if (!MessageActivity.this.isOnClick()) {
                ARouter.getInstance().build(Constance.FANS_MESSAGE_ACTIVITY).withInt(Key.USER_ID, SpUtils.getInstance().getUserInfo().getUserId()).navigation();
            }
        }

        public void btnLike() {
            if (!MessageActivity.this.isOnClick()) {
                ARouter.getInstance().build(Constance.LIKE_MESSAGE_ACTIVITY).navigation();
            }
        }

        public void btnComment() {
            if (!MessageActivity.this.isOnClick()) {
                ARouter.getInstance().build(Constance.REPLY_COMMENT_ACTIVITY).navigation();
            }
        }

        public void btnOnline() {
            if (!MessageActivity.this.isOnClick()) {
                ARouter.getInstance().build(Constance.ONLINE_SERVICE_ACTIVITY).navigation();
            }
        }

        public void btnNotice() {
            if (!MessageActivity.this.isOnClick()) {
                ARouter.getInstance().build(Constance.NOTIFICATION_ACTIVITY).navigation();
            }
        }

        public void contactOfficial() {
            if (!MessageActivity.this.isOnClick()) {
                ARouter.getInstance().build(Constance.CONTACT_OFFICIAL_ACTIVITY).navigation();
            }
        }
    }
}
